export const X6_NODE_NAME = 'dag-task';
export const X6_EDGE_NAME = 'dag-edge'
export const X6_PORT_OUT_NAME = 'dag-port-out'
export const PORT = {
    groups: {
        [X6_PORT_OUT_NAME]: {
            position: {
                name: 'absolute',
                args: {
                    x: 200,
                    y: 24
                }
            },
            markup: [
                {
                    tagName: 'g',
                    selector: 'body',
                    children: [
                        {
                            tagName: 'circle',
                            selector: 'circle-outer'
                        },
                        {
                            tagName: 'text',
                            selector: 'plus-text'
                        },
                        {
                            tagName: 'circle',
                            selector: 'circle-inner'
                        }
                    ]
                }
            ],
            attrs: {
                body: {
                    magnet: true
                },
                'plus-text': {
                    fontSize: 12,
                    fill: '#333',
                    text: '+',
                    textAnchor: 'middle',
                    x: 0,
                    y: 3
                },
                'circle-outer': {
                    stroke: '#888',
                    strokeWidth: 1,
                    r: 6,
                    fill: '#f1f1f1'
                },
                'circle-inner': {
                    r: 4,
                    fill: 'transparent'
                }
            }
        }
    }
}
export const NODE = {
    width: 220,
    height: 48,
    markup: [
        {
            tagName: 'rect',
            selector: 'body',
            className: 'dag-task-body'
        },
        {
            tagName: 'image',
            selector: 'image'
        },
        {
            tagName: 'text',
            selector: 'title'
        }
    ],
    attrs: {
        body: {
            refWidth: '100%',
            refHeight: '100%',
            rx: 6,
            ry: 6,
            pointerEvents: 'visiblePainted',
            fill: '#fff',
            stroke: '#333',
            strokeWidth: 1,
            strokeDasharray: 'none',
            filter: 'none'
        },
        image: {
            width: 30,
            height: 30,
            refX: 12,
            refY: 9
        },
        title: {
            refX: 45,
            refY: 18,
            fontFamily: 'Microsoft Yahei',
            fontSize: 12,
            fontWeight: 'bold',
            fill: '#999',
            strokeWidth: 0
        },
        fo: {
            refX: '46%',
            refY: -25
        }
    },
    ports: {
        ...PORT,
        items: [
            {
                id: X6_PORT_OUT_NAME,
                group: X6_PORT_OUT_NAME
            }
        ]
    },
    // tools: [
    //     {
    //         name: 'contextmenu'
    //     }
    // ]
}
export const EDGE_COLOR = '#00f'
export const BG_WHITE = '#fff'
export const EDGE = {
    attrs: {
        line: {
            stroke: EDGE_COLOR,
            strokeWidth: 1,
            targetMarker: {
                tagName: 'path',
                fill: EDGE_COLOR,
                strokeWidth: 0,
                d: 'M 6 -3 0 0 6 3 Z'
            },
            filter: 'none'
        }
    },
    connector: {
        name: 'rounded'
    },
    router: {
        name: 'manhattan',
        args: {
            endDirections: ['top', 'bottom', 'left']
        }
    },
    defaultLabel: {
        markup: [
            {
                tagName: 'rect',
                selector: 'body'
            },
            {
                tagName: 'text',
                selector: 'label'
            }
        ],
        attrs: {
            label: {
                fill: EDGE_COLOR,
                fontSize: 14,
                textAnchor: 'middle',
                textVerticalAnchor: 'middle',
                pointerEvents: 'none'
            },
            body: {
                ref: 'label',
                fill: BG_WHITE,
                stroke: EDGE_COLOR,
                strokeWidth: 1,
                rx: 4,
                ry: 4,
                refWidth: '140%',
                refHeight: '140%',
                refX: '-20%',
                refY: '-20%'
            }
        },
        position: {
            distance: 0.5,
            options: {
                absoluteDistance: true,
                reverseDistance: true
            }
        }
    }
}